
/* 

Paper: Gentrification and pioneer businesses 
Authors: Behrens, Boulam, Martin, Mayneris 

Name dofile: compute_elasticity_logit.do  
Version: 12 nov. 2021 

Output: 15 datasets with the elasticty of of the number of establishments to gentrification  
(9 measures of gentrifications {sh_edu pc_income, gentri} X {250m, 500m, contig})

Inputs:

- naics_id_conc_database.dta 
- id_conc_pop_income.dta 

*/ 

global dep dum
global base_demo id_conc_pop_income


// Gentrification measured using income per capita 
local n 1990 
use naics_id_conc_database, clear 
global year `n'
keep if year==$year
drop sect 
sort naics 
egen sect=group(naics) 
sum sect 
global max = r(max) 
global label _dum_pc_`n'
global condition if (time1==1&emp>0)
global explanatory lpop250 lemp250 lcrent poor_init250 pc_gr_poor_init250  
global output pioneer_gentri90_only250$label
	do logit_dum_rev
	
set more off
global condition if (time1==1&emp>0)
global explanatory lpop500 lemp500 lcrent poor_init500 pc_gr_poor_init500 
global output pioneer_gentri90_only500$label
	do logit_dum_rev

	set more off
global condition if (time1==1 &emp>0)
global explanatory lpopcont lempcont lcrent poor_initcont pc_gr_poor_initcont  
global output pioneer_gentri90_onlycont$label
	do logit_dum_rev


// Gentrification measured using the share of educated 
local n 1990 
use naics_id_conc_database, clear 
global year `n'
keep if year==$year
drop sect 
sort naics 
egen sect=group(naics) 
sum sect 
global max = r(max) 
global label _dum_sh_edu_`n'
global condition if (time1==1&emp>0)
global explanatory lpop250 lemp250 lcrent poor_init250 sh_edu_gr_poor_init250 
global output pioneer_gentri90_only250$label
	do logit_dum_rev
	
set more off
global condition if (time1==1&emp>0)
global explanatory lpop500 lemp500 lcrent poor_init500 sh_edu_gr_poor_init500 
global output pioneer_gentri90_only500$label
	do logit_dum_rev

	set more off
global condition if (time1==1 &emp>0)
global explanatory lpopcont lempcont lcrent poor_initcont sh_edu_gr_poor_initcont 
global output pioneer_gentri90_onlycont$label
	do logit_dum_rev

// Gentrification measured using the gentrification dummy 
local n 1990 
use naics_id_conc_database, clear 
global year `n'
keep if year==$year
drop sect 
sort naics 
egen sect=group(naics) 
sum sect 
global max = r(max) 
global label _dum_gentri_`n'
global condition if (time1==1&emp>0)
global explanatory lpop250 lemp250 lcrent poor_init250 gentri_init250 
global output pioneer_gentri90_only250$label
	do logit_dum_rev
	
set more off
global condition if (time1==1&emp>0)
global explanatory lpop500 lemp500 lcrent poor_init500 gentri_init500
global output pioneer_gentri90_only500$label
	do logit_dum_rev

	set more off
global condition if (time1==1 &emp>0)
global explanatory lpopcont lempcont lcrent poor_initcont gentri_initcont
global output pioneer_gentri90_onlycont$label
	do logit_dum_rev

